<div class="continer">
	<!--#usernameRef，这个叫引用（reference）。注意这个引用是的input对象，我们如果想传递input的值，可以用usernameRef.value-->
	<form #formRef="ngForm" (ngSubmit)="onSubmit(formRef.value)">
		<!--<fieldset ngModelGroup="login">意味着我们对于fieldset之内的数据都分组到了login对象中。-->
		<!--<fieldset>在一组控件周围建立边框-->
		<!--fieldset标签将这组控件捆绑在一个屏幕上。-->
		<!--legend：说明每组的内容描述-->
		<fieldset ngModelGroup="login">
			<legend>登录</legend>
			<input [(ngModel)]="username" [typeahead]="states" class="form-control" #usernameRef="ngModel" placeholder="please enter username"
				name="username" required minlength="3" type="text">

			<div>
				<!--{{usernameRef.errors | json}}-->
				<div *ngIf="usernameRef.errors?.required">this is required</div>
				<div *ngIf="usernameRef.errors?.minlength">should be at least 3 charactors</div>
			</div>
			<br>
			<input [(ngModel)]="password" [typeahead]="states" class="form-control"  #passwordRef="ngModel" placeholder="please enter password" name="password" required type="password">
			<div>
				<!--{{passwordRef.errors | json}}-->
				<div *ngIf="passwordRef.errors?.required">this is required</div>
			</div>
			<div *ngIf="auth?.hasError">{{auth.errMsg}}</div>
			<br>
			<!--<button type="submit">Login</button>-->
			<button type="submit" class="btn btn-primary" btnCheckbox btnCheckboxTrue="1" btnCheckboxFalse="0">Login
			</button>
		</fieldset>
	</form>
</div>